var mz_util = util = {
    getStarLevel: function(a) { if (!a) { return 0 } else { if (a > 0 && a < 10) { return "01" } else { a += ""; return a.substring(0, 1) + (a.substring(1, 2) == 0 ? "0" : "1") } } },
    formatNum: function(b) {
        var a = ["", "", "", "K", "W", "W", "W", "KW"];
        var c = { K: 1000, W: 10000, KW: 10000000 };
        var d, e;
        b += "";
        if (!b || isNaN(Number(b))) { return "0" }
        d = b.length >= 8 ? a[7] : a[b.length - 1];
        e = d ? b / c[d] : b;
        if (/^\d+\.\d+$/.test(e)) {
            d += "+";
            e = parseInt(e)
        }
        return e + d
    },
    formatPrice: function() {
        $(".price").each(function() {
            var a = Number($(this).text().replace("￥", ""));
            (isNaN(a) || !a) ? $(this).text("免费"): $(this).text("￥" + a.toFixed(2))
        })
    },
    getUrlParam: function(a) { var b = new RegExp("(^|&)" + a + "=([^&]*)(&|$)", "i"); var c = window.location.search.substr(1).match(b); if (c != null) { return unescape(c[2]) } return null },
    sendToSiNa: function() { window.open("http://v.t.sina.com.cn/share/share.php?url=" + encodeURIComponent(location.href) + "&title=" + encodeURIComponent(document.title) + "") },
    sendToTenCent: function() {
        var f = encodeURI(document.title);
        var c = encodeURIComponent(document.location);
        var e = encodeURI("bc4cdb3027304d94b339bd027543837c");
        var b = encodeURI("document.images");
        var a = "http://app.meizu.com/apps/public/index";
        var d = "http://v.t.qq.com/share/share.php?url=" + c + "&appkey=" + e + "&site=" + a + "&pic=" + b + "&title=" + f;
        window.open(d, "")
    },
    initStars: function() {
        $(".star_bg").each(function(a, c) {
            var b = $(this).attr("data-num");
            $(this).addClass("star_" + mz_util.getStarLevel(b))
        })
    },
    formatDownloadNum: function() {
        $(".download_num").each(function() {
            var a = $(this).attr("add_desc") == "no" ? "" : "下载次数：";
            $(this).text(a + mz_util.formatNum($(this).text()))
        })
    },
    initSearch: function() {
        var a = this;
        $("#flymeSearch").jsonSuggest("", { uri: "/apps/public/", ajaxResults: true, idInput: "appId", matchField: "appName", minSearchLength: 1, maxResults: 10, mouseBlur: function() {}, onSelect: function() { $("#flymeSearchBtn").trigger("click") } }).focus(function() {
            $(".default_val").hide();
            $(this).css("color", "#000000")
        }).blur(function() {
            if ($.trim($(this).val()) == "") {
                $(this).css("color", "#BEBEBE");
                $(".default_val").show()
            }
        });
        $(".default_val").click(function() {
            $(this).hide();
            $("#flymeSearch").focus()
        });
        $("#flymeSearchBtn").click(function() {
            var b = $.trim($("#flymeSearch").val());
            if (b == "") { return }
            location = "/themes/public/search/page?mzos=" + util.getMzos() + "&keyword=" + encodeURIComponent(a.reviseKeyword(b))
        });
        $(".logo").click(function() { window.open("http://www.flyme.cn") });
        $(".head a").click(function() {
            $(this).css({ color: "deepskyblue" });
            $(this).siblings().css({ color: "" });
            location = $(this).attr("data-href")
        })
    },
    reviseKeyword: function(a) { var b = a.replace(/\\{2,}/g, "\\"); return b },
    isPC: function() { return !/^.*AppleWebKit.*Mobile.*$/.test(navigator.userAgent) },
    selectMenu: function(a) { $(".head a[data=" + a + "]").addClass("current").siblings().removeClass("current") },
    setNavTitle: function(a) { $(".content_nav").html(a) },
    getDialogHtml: function() { return '<div class="dialog_bg none dialog_flg"></div><div class="dialog_box none dialog_flg"><div class="dialog_title"><a class="dialog_close"></a></div><div class="dialog_content"></div><div class="dialog_bottom"></div></div>' },
    dialog: function(e) {
        $(".dialog_flg").remove();
        $("body").append(mz_util.getDialogHtml());
        $(".dialog_title").append("<span>" + (e.title || "提示") + "</span>");
        $(".dialog_content").text(e.content);
        var b = [];
        var c = e.buttons;
        for (var d = 0; d < c.length; d++) {
            var a = c[d];
            b.push('<div class="dialog_button ' + a.clas + '">' + a.name + "</div>")
        }
        $(".dialog_bottom").append(b.join(""));
        $(".dialog_close").click(function() { $(".dialog_flg").remove() });
        $.each(c, function(f, g) {
            $(".dialog_button." + g.clas.replace(/ /g, ".")).click(function() {
                $(".dialog_flg").remove();
                g.fn && g.fn()
            })
        });
        $(".dialog_box").css({ left: $(window).width() / 2 - 200, top: $(window).height() / 2 - $(".dialog_box").height() / 2 });
        $(".dialog_flg").show()
    },
    alert: function(c, b, a) { mz_util.dialog({ content: c, title: b, buttons: [{ name: "确定", fn: a, clas: "sure dialog_button1" }] }) },
    confirm: function(d, b, c, a) { mz_util.dialog({ content: d, title: c, buttons: [{ name: "确定", fn: b, clas: "sure" }, { name: "取消", fn: a, clas: "cancel" }] }) },
    footBottom: function() { $(".content_main").css("min-height", $(window).height() - (mz_util.isPC() ? 358 : 270) + "px") },
    initDownload: function() {
        $(".download_container").on("mouseenter", ".downloading", function() {
            if ($(this).find(".price").is(":visible")) { return }
            $(this).find(".star_bg").hide();
            $(this).find(".price").show().css({ width: "68px", clear: "both", "margin-top": 0 })
        }).on("mouseleave", ".downloading", function() {
            if ($(this).find(".star_bg").is(":visible") || $(this).attr("data-detail")) { return }
            $(this).find(".price").hide();
            $(this).find(".star_bg").show()
        }).on("mouseenter", ".downloading .price", function() { if ($(this).text() != "免费") { mz_util.showTip($(this), "请登录魅族客户端购买"); return false } }).on("mouseleave", ".downloading .price", function() { mz_util.hideTip() }).on("click", ".downloading .price", function(a) {
            (a || event).stopPropagation();
            if ($(this).text() != "免费") { mz_util.showTip($(this), "请登录魅族客户端购买"); return false }
            var b = $(this).parents(".downloading");
            downloadController.download(b.attr("data-appId"), b.attr("data-catId"), $(this))
        })
    },
    showTip: function(d, c) {
        var b = d.offset().left + 2 + "px";
        var a = d.offset().top + d.height() + 5 + "px";
        $(".tip_msg").css({ top: a, left: b }).text(c).show()
    },
    hideTip: function() { $(".tip_msg").fadeOut("fast") },
    showMore: function() { $(".show_more").click(function() { var a = this; var b = $(this).next().attr("value"); if (b != null) { if ($(a).parent().hasClass("description_detail")) { $(a).parent().text(b) } else { $(a).parent().parent().text(b) } } }) },
    autoLogin: function(a) {
        $("#flymeFrame,#meizuFrame").remove();
        $("body").append("<iframe id='flymeFrame' name='flymeFrame' class='none' src='http://app.flyme.cn/apps/console/personal'></iframe>");
        $("body").append("<iframe id='meizuFrame' name='meizuFrame' class='none' src='http://app.meizu.com/apps/console/personal'></iframe>");
        location.href.indexOf("flyme.cn") >= 0 && $("#flymeFrame").one("load", function() {
            global.initLogin();
            a && a.call()
        });
        location.href.indexOf("meizu.com") >= 0 && $("#meizuFrame").one("load", function() {
            global.initLogin();
            a && a.call()
        })
    },
    getMzos: function() { return "4.0" },
    request: function(b) {
        var a = this;
        var c = { type: b.type || "get", url: b.action, data: b.params || {}, success: function(d) { if (d.code == 200) { b.cb && b.cb(d) } }, error: function(e, d) {}, complete: function(e, d) {} };
        if (b.addMzosHeader) { c.headers = { mzos: b.mzos || a.getMzos() } }
        if (b.dataType) { c.dataType = b.dataType }
        $.ajax(c)
    }
};
var global = { notLoginUrls: ["www.flyme.cn/firmware.jsp", "www.flyme.cn/firmwarelist.jsp"] };
global.initLanguage = function() {
    var c = $("#globalName"),
        e = $("#globalContainer"),
        b = c.position(),
        a = null;
    e.css({ left: b.left, bottom: b.top + 50 });
    var d = function(f) {
        f.on("mouseover", function() {
            clearTimeout(a);
            global.initLanguage();
            e.show()
        }).on("mouseout", function() { a = setTimeout(function() { e.hide() }, 500) })
    };
    d(c);
    d(e)
};
global.initOnline = function() { $("#service-online").live("click", function() { window.open("http://url.meizu.com/ols_Fapp", "_blank", "height=768,width=1200,fullscreen=3,top=200,left=200,status=yes,toolbar=no,menubar=no,resizable=no,scrollbars=no,location=no,titlebar=no,fullscreen=no") }) };
global.initWeChat = function() {
    var b = $("#footer-weChat");
    var a = $("#wechatPic");
    $("#footer-weChat i").hover(function() { a.css({ left: b.offset().left - 140, top: b.offset().top - 276 }).show() }, function() { a.hide() }).click(function() { return false })
};
global.initLogin = function() {
    function c(d) { var g = document.cookie.split("; "); for (var f = 0; f < g.length; f++) { var e = g[f].split("="); if (e[0] == d) { return unescape(e[1]) } } }
    var a = c("_islogin");
    if (a === "true" || location.href.indexOf("app.meizu.com") >= 0 || location.href.indexOf("app.flyme.cn") >= 0) {
        var b = $("<script src='https://member.meizu.com/service/accounts/fetchOrder.jsonp?callback=global.loginCallback&v=" + Math.random() + "'><\/script>");
        $(document.body).append(b);
        setTimeout(function() { b.remove() }, 0)
    } else {
        $("#loginWrap").hide();
        $("#unloginWrap").show()
    }
};
global.loginCallback = function(a) {
    a = a.reply;
    if (a && a.nickname) {
        $("#w_notify").text(a.nickname).attr("title", a.nickname);
        $("#_assertion_nickname").val(a.nickname);
        $("#loginWrap").show();
        $("#unloginWrap").hide()
    } else {
        $("#loginWrap").hide();
        $("#unloginWrap").show();
        $("#_assertion_nickname").val("")
    }
    downloadController.init(true)
};
var mz_data = { pic_interval_time: 5000, msg_hide_time: 5000 };
var downloadController = {
    appId: 0,
    islogin: false,
    catId: "1",
    template: "infoDialog",
    consoleDownloadUrl: "/themes/console/download.json",
    publicDownloadUrl: "/themes/public/download.json",
    download2deviceUrl: "/themes/console/download2device.json",
    mzOsListUrl: "/themes/public/mzos.json",
    screenSizeListUrl: "/themes/public/screen_size.json",
    returnMessageObj: null,
    responseData: null,
    isFree: true,
    init: function(a) {
        var b = $("#_assertion_nickname").val();
        this.islogin = b && b.length;
        this.bindEvent();
        this.returnMessageObj = $("#returnMessage");
        !a && mz_util.initDownload()
    },
    refreshScreenSizeSelector: function() {
        var b = this;
        var g = $("#screeSizeSelector");
        var a = $("#flymeSelector");
        if (g) {
            g.empty();
            if (a && a.val()) {
                var d = b.screenSizeListUrl;
                var e = b.appId;
                var f = a.val();
                var c = { app_id: e, mzos: f };
                util.request({ action: d, params: c, addMzosHeader: true, mzos: f, cb: function(h) { if (h.code == 200 && h.value) { $.each(h.value, function(k, j) { g.append("<option value='" + j.url + "'>" + j.screenSizeName + "</option>") }) } } })
            }
        }
    },
    download: function(d, b, e) {
        b = b + "";
        var c = "";
        if (b == "5") {
            c = e.parents(".downloading").attr("data-param-mzos") || $("#count").attr("data-param-mzos") || $('#main_param').attr('data-param-mzos') || $('#hiddenParams').attr('data-param-mzos');
            this.resetAttr4Theme(d, b, c)
        } else { this.resetAttr(d, b) }
        var a = this;
        a.returnMessageObj.html("&nbsp;");
        if (a.islogin) { a.loginDownload(c) } else { if (a.catId == "5") { a.noLoginThemeDownload(c) } else { a.noLoginDownload() } }
    },
    loginDownload: function(d) {
        var a = this;
        var e = a.appId;
        var b = { app_id: e };
        var c = a.consoleDownloadUrl;
        util.request({
            action: c,
            params: b,
            mzos: c.split("?")[1].split("=")[1] || util.getMzos(),
            addMzosHeader: true,
            cb: function(h) {
                var g = h.code;
                var f = h.value;
                if (g == 200 && f) {
                    if (f.isFree) {
                        a.downloadUrl = f.downloadUrl;
                        a.loadTemplate(f);
                        if ($("#deviceSelector").length) {
                            var i = f.deviceList;
                            a.refreshDeviceSelector(i)
                        }
                        if ($("#flymeSelector").length) {
                            a.refreshMzOsSelector(d);
                            a.bindMzOsEvent()
                        }
                        a.setWinPosition();
                        a.checkedSelector(f.deviceList);
                        a.showWin();
                        mz_util.initStars()
                    } else { a.alertMessage("所有付费应用及主题在网站仅提供预览，需要在手机客户端进行购买及安装。") }
                } else { if (h.message == "您还未登录" || h.indexOf("您还未登录") >= 0) { mz_util.autoLogin(function() { downloadController.download(a.appId, a.catId) }) } else { a.alertMessage(h.message) } }
            }
        })
    },
    noLoginThemeDownload: function(d) {
        var a = this;
        var c = a.mzOsListUrl;
        var e = a.appId;
        var b = { app_id: e, mzos: d };
        a.noLoginDownload()
    },
    noLoginDownload: function() {
        var a = this;
        var c = a.publicDownloadUrl;
        var d = a.appId;
        var b = { app_id: d };
        util.request({
            action: c,
            params: b,
            mzos: c.split("?")[1].split("=")[1] || util.getMzos(),
            addMzosHeader: true,
            cb: function(f) {
                var e = f.value;
                if (f.code == 200 && e) { if (e.isFree) { var g = e.downloadUrl; if (g) { a.downloadApp(g) } } else { a.alertMessage("所有付费应用及主题在网站仅提供预览，需要在手机客户端进行购买及安装。") } } else {
                    a.downloadUrl = "";
                    a.alertMessage(f.message)
                }
            }
        })
    },
    loadTemplate: function(b) { var a = this; if (b) { $("#alert_content").html($(a.template).tmpl(b)) } },
    refreshDeviceSelector: function(b) { var a = this; if (b && b.length > 0) { $.each(b, function(d, c) { $("#deviceSelector").append("<option value='" + c.imei + "_" + c.sn + "' title='IMEI：" + c.imei + "'>" + c.type + "</option>") }) } },
    refreshMzOsSelector: function(a) {
        $("#flymeSelector").hide();
        $("#screeSizeSelector").hide()
    },
    renderMzOsSelector: function(c) {
        var b = this;
        var a = $("#flymeSelector");
        if (a.length) {
            a.empty();
            $.each(c, function(e, f) { a.append("<option value='" + f.id + "'>" + f.mzOsName + "</option>") });
            var d = c[0].id;
            a.val(d);
            b.refreshScreenSizeSelector()
        }
    },
    setWinPosition: function() { $("#alert_box").css({ left: ($(window).width() - $("#alert_box").width()) / 2, top: ($(window).height() - $("#alert_box").height()) / 2 }) },
    showWin: function() { $("#alert_box, .alert_bg").show() },
    checkedSelector: function(d) {
        var b = this;
        var a = $("[downloadTarget=host]");
        var c = $("[downloadTarget=device]");
        if (a.length + c.length > 1) {
            if (d && d.length > 0) { checkedObj = c } else { checkedObj = a }
            checkedObj.addClass("checked").siblings("li").removeClass("checked");
            b.enableDownloadBtn()
        }
    },
    showMessageInWin: function(b) {
        var a = this;
        a.returnMessageObj.html(b)
    },
    clearMessageInWin: function(b) {
        var a = this;
        a.returnMessageObj.html(" ")
    },
    disableDownloadBtn: function() { var a = $("#alertBtn"); if (a.length) { a.addClass("disBtn").removeClass("liveBtn") } },
    enableDownloadBtn: function() { var a = $("#alertBtn"); if (a.length) { a.addClass("liveBtn").removeClass("disBtn") } },
    bindMzOsEvent: function() {
        var a = this;
        $("#flymeSelector").change(function() { a.refreshScreenSizeSelector() })
    },
    alertMessage: function(a) { mz_util.alert(a, "提示") },
    bindEvent: function() {
        var a = this;
        $("#closeDownloadBtn").click(function() { $("#alert_box, .alert_bg").hide() });
        $("#alert_content").on("click", ".option_cont li", function() {
            if ($(this).find("#deviceSelector").length && !$("#deviceSelector").val()) { return }
            var b = $("#alertBtn");
            if (b) { if ($(this).attr("downloadTarget") == "host" || $("#deviceSelector").val()) { b.addClass("liveBtn").removeClass("disBtn") } else { b.addClass("disBtn").removeClass("liveBtn") } }
            $(this).addClass("checked").siblings("li").removeClass("checked")
        });
        $(".liveBtn").unbind("click").click(function() {
            if ($(this).hasClass("disBtn")) { return }
            a.clearMessageInWin();
            var f = $("#alert_content .checked").attr("downloadTarget");
            if (f == "device") {
                var c = $("#deviceSelector").val();
                var d = a.download2deviceUrl;
                var b = { app_id: a.appId, device: c };
                a.disableDownloadBtn();
                util.request({
                    type: "POST",
                    action: d,
                    params: b,
                    mzos: d.split("?")[1].split("=")[1] || util.getMzos(),
                    addMzosHeader: true,
                    cb: function(h) {
                        var g = h.value;
                        if (h.code == 200) { a.showMessageInWin("已推送至手机，请注意查看") } else { a.showMessageInWin(h.message) }
                        setTimeout(function() { a.returnMessageObj.html("&nbsp;") }, mz_data.msg_hide_time);
                        a.enableDownloadBtn()
                    }
                })
            } else {
                var e = $("#screeSizeSelector");
                if (a.catId == "5" && e && e.val() && e.val().length > 0) {
                    var d = e.val();
                    a.downloadApp(d)
                } else {
                    if (a.downloadUrl && a.downloadUrl.length > 0) {
                        a.downloadApp(a.downloadUrl);
                        $("#alert_box, .alert_bg").hide()
                    } else { a.showMessageInWin("下载地址错误") }
                }
            }
        })
    },
    downloadApp: function(c) {
        var a = this;
        var b = "iframe" + a.appId;
        $("#" + b).remove();
        $("body").append("<iframe class='none' id='" + b + "' name='" + b + "' src='" + c + "'></iframe>");
        $("#" + b).one("load", function() {
            try {
                if (!this.contentWindow.document) {
                    $("#alert_box, .alert_bg").hide();
                    mz_util.alert("下载地址无效！", "提示");
                    $("#" + b).remove()
                }
            } catch (d) {
                $("#alert_box, .alert_bg").hide();
                mz_util.alert("下载地址无效！", "提示");
                $("#" + b).remove()
            }
        })
    },
    resetAttr: function(b, a) {
        this.appId = b;
        this.catId = a;
        this.responseData = null;
        this.downloadUrl = "";
        switch (a) {
            case "1":
                this.template = "#infoDialog";
                this.consoleDownloadUrl = "/apps/console/download.json";
                this.publicDownloadUrl = "/apps/public/download.json";
                this.download2deviceUrl = "/apps/console/download2device.json";
                break;
            case "2":
                this.template = "#infoDialog";
                this.consoleDownloadUrl = "/games/console/download.json";
                this.publicDownloadUrl = "/games/public/download.json";
                this.download2deviceUrl = "/games/console/download2device.json";
                break;
            default:
        }
    },
    resetAttr4Theme: function(c, a, b) {
        this.appId = c;
        this.catId = a;
        this.responseData = null;
        this.downloadUrl = "";
        if (this.islogin) { this.template = "#infoDialogTheme" } else { this.template = "#infoDialogThemeNoLogin" }
        this.publicDownloadUrl = "/themes/public/download.json?mzos=" + b;
        this.consoleDownloadUrl = "/themes/console/download.json?mzos=" + b;
        this.download2deviceUrl = "/themes/console/download2device.json?mzos=" + b
    }
};
var photoesController = {
    moveIdx: 0,
    timmer: null,
    initImgSlider: function() {
        var c = this;
        var a = $("#bannerImgList").find("img").length;
        if (a <= 1) { $("#bannerIdxList").hide(); return }

        function b() {
            $("#bannerImgList").animate({ left: -1000 * c.moveIdx + "px" }, "slow");
            $(".banner_idx").removeClass("inner").addClass("outter");
            $(".banner_idx:eq(" + (a - 1 - c.moveIdx) + ")").removeClass("outter").addClass("inner");
            (++c.moveIdx >= a) && (c.moveIdx = 0)
        }
        $("#bannerImgList").css({ width: a * 1000 + "px", left: 0 });
        $("#bannerIdxList").on("click", "span", function() {
            c.moveIdx = a - 1 - $(".banner_idx").index(this);
            b()
        });
        b();
        c.timmer = setInterval(function() { b() }, mz_data.pic_interval_time);
        $("#bannerImgList").on("mouseenter", "img", function() { clearInterval(c.timmer) }).on("mouseleave", "img", function() { c.timmer = setInterval(function() { b() }, mz_data.pic_interval_time) })
    }
};
var mzScroll = {
    sliderId: "slider",
    pageCount: 5,
    speed: 500,
    liWidth: 205,
    liHeight: 364,
    isVital: true,
    picX: 205,
    picY: 364,
    separate: 12,
    init: function() {
        this.bindEvents();
        this.check_width()
    },
    bindEvents: function() {
        eachWidth = mzScroll.liWidth;
        tmpW = eachWidth / 2;
        moveWidth = Math.floor(tmpW + mzScroll.picX / 2 - (tmpW - mzScroll.picX / 2 - mzScroll.separate));
        lastIndex = $(".mainlist li").length - 1;
        currentIndex = 0;
        linum = $(".mainlist li").length;
        w = linum * 217;
        $("#left_button").hide();
        if (linum <= 3) {
            $("#left_button").hide();
            $("#right_button").hide()
        } else { $("#right_button").show() }
        $(".piclist").css("width", w + "px");
        $("#left_button").click(function() {
            if (currentIndex > 0) { mzScroll.animate_move("prev") }
            $("#right_button").show();
            if (currentIndex == 0) { $("#left_button").hide() }
        });
        $("#right_button").click(function() {
            if ((currentIndex) < lastIndex - 2) { mzScroll.animate_move("next") }
            $("#left_button").show();
            if (linum >= 4) { if (currentIndex == linum - 3) { $("#right_button").hide() } }
        })
    },
    animate_move: function(a) {
        var c = currentIndex;
        if (a == "next") { currentIndex++ } else { currentIndex-- }
        if (currentIndex > lastIndex) { return }
        var b = (currentIndex * moveWidth * -1);
        $(".mainlist").animate({ left: b }, mzScroll.speed)
    },
    check_width: function() {
        $("#imagesList li").each(function() {
            var a = this;
            var b = $(a).find(".detail_img img").attr("src");
            var c = new Image();
            c.onload = function() {
                var j = c.width,
                    i = c.height;
                var l = (j == "1280" && i == "800"),
                    m = (j == "800" && i == "1280"),
                    n = (j == "1800" && i == "1080"),
                    d = (j == "1080" && i == "1800"),
                    e = (j == "1920" && i == "1152"),
                    f = (j == "1152" && i == "1920"),
                    g = (j == "2560" && i == "1536"),
                    h = (j == "1536" && i == "2560");
                if (m || d || f || h) { $(a).find(".detail_img img").removeClass("screenImg2").addClass("screenImg1") } else { $(a).find(".detail_img img").removeClass("screenImg1").addClass("screenImg2") }
                var k = (364 - parseInt($(a).css("height"))) / 2;
                $(a).css("margin-top", (k < 0 ? 0 : k) + "px")
            };
            c.src = b
        })
    }
};
Date.prototype.format = function(c) { var b = { "M+": this.getMonth() + 1, "d+": this.getDate(), "h+": this.getHours(), "m+": this.getMinutes(), "s+": this.getSeconds(), "q+": Math.floor((this.getMonth() + 3) / 3), S: this.getMilliseconds() }; if (/(y+)/.test(c)) { c = c.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length)) } for (var a in b) { if (new RegExp("(" + a + ")").test(c)) { c = c.replace(RegExp.$1, RegExp.$1.length == 1 ? b[a] : ("00" + b[a]).substr(("" + b[a]).length)) } } return c };
$(function() {
    mz_util.initSearch();
    mz_util.initStars();
    mz_util.formatDownloadNum();
    mz_util.footBottom();
    mz_util.formatPrice();
    downloadController.init();
    global.initLogin();
    global.initOnline();
    global.initWeChat();
    $(window).resize(mz_util.footBottom);
    $(document).ajaxSend(function(a, c, b) { b.url = b.url.replace(/(\?|&)_=\d+$/, "") });
    if ($("#flymeSearch").val()) { $(".default_val").hide() } else { $(".default_val").show() }
});